import { stringify } from 'qs';
import request from '@/utils/request';

export async function trueAccountLogin(params) {
  return request('/web/users/loginweb4', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function getHomeAnalysisDataPost(params) {
  return request('/web/repairstatistics/getHomeAnalysisData', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 获取工单列表数据
 * @param params
 * @returns {Promise<void>}
 */
export async function getRepairsList(params) {
  const { state } = params;
  if (state == '4') {
    return request('/web/repair/queryAllWithStateAndOwned', {
      method: 'POST',
      body: {
        ...params,
        method: 'post',
      },
    });
  } else {
    return request('/web/repair/queryAllWithState3', {
      method: 'POST',
      body: {
        ...params,
        method: 'post',
      },
    });
  }
}

/**
 * 修改工单关闭提醒状态
 * @param params
 * @returns {Promise<void>}
 */
export async function updateCloseTipState(params) {
  return request('/web/repair/updateCloseTipState', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 删除工单
 * @param params
 * @returns {Promise<void>}
 */
export async function delRepair(params) {
  return request('/web/repair/del', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}


/**
 * 新增活动
 * @param params
 * @returns {Promise<void>}
 */
export async function saveActivity(params) {
  const { state } = params;
  return request('/web/activity/save', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 查询活动列表
 * @param params
 * @returns {Promise<void>}
 */
export async function getActivityList(params) {
  return request('/web/activity/list', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 发布活动
 * @param params
 * @returns {Promise<void>}
 */
export async function pubnishActivityOnline(params) {
  return request('/web/activity/pubnish', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 删除活动
 * @param params
 * @returns {Promise<void>}
 */
export async function delActivity(params) {
  return request('/web/activity/del', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 编辑活动
 * @param params
 * @returns {Promise<void>}
 */
export async function editActivity(params) {
  return request('/web/activity/edit', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 获取客户列表
 * @param params
 * @returns {Promise<void>}
 */
export async function getContactsList(params) {
  return request('/web/contact/getContacts4Web', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}


/**
 * 新增客户
 * @param params
 * @returns {Promise<void>}
 */
export async function saveContact(params) {
  return request('/web/contact/add3', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 编辑客户
 * @param params
 * @returns {Promise<void>}
 */
export async function editContact(params) {
  return request('/web/contact/update3', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}


/**
 * 删除客户
 * @param params
 * @returns {Promise<void>}
 */
export async function delContact(params) {
  return request('/web/contact/del3', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 获取门店二维码扫描数据
 * @param params
 * @returns {Promise<void>}
 */
export async function getXcxScanNums(params) {
  return request('/web/xcx/xcxScanLoginStatics', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}


export async function addMedia(params) {
  return request('/web/media/add', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function addNewsCategory(params) {
  return request('/web/news/addCategory', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function delNewsCategory(params) {
  return request('/web/news/delCategory', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function editNewsCategory(params) {
  return request('/web/news/editCategory', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function getNewsCategorys(params) {
  return request('/web/news/getCategorys', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function addNewsDetail(params) {
  return request('/web/news/addDetail', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function editNewsDetail(params) {
  return request('/web/news/editDetail', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function delNewsDetail(params) {
  return request('/web/news/delDetail', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}


export async function getNewsDetail(params) {
  return request('/web/news/getDetail', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function getNewsDetails(params) {
  return request('/web/news/getDetails', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function getNewsDetails2(params) {
  return request('/web/news/getDetails2', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function getServicesTempaltes(params) {
  return request('/web/package/queryTemplates', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function getShopServices(params) {
  return request('/web/ServiceTopType/preview', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 新增会员卡套餐模版
 * @param params
 * @returns {Promise<void>}
 */
export async function addServicesTempalte(params) {
  return request('/web/package/addPackageTemplate', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 新增会员卡套餐
 * @param params
 * @returns {Promise<void>}
 */
export async function addPackage(params) {
  return request('/web/package/addPackage', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}


export async function delServicesTempalte(params) {
  return request('/web/package/delPackageTemplate', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function editServicesTemplate(params) {
  return request('/web/package/editServicesTemplate', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 新增一个套餐模版里的服务,无contactid，也无price
 * @param params
 * @returns {Promise<void>}
 */
export async function addServicesTempalteItem(params) {
  return request('/web/package/addService2', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}


export async function getVipCardList(params) {
  return request('/web/vipcard/getVipCardList', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function queryContacts(params) {
  return request('/web/contact/queryContacts', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function addVipCard(params) {
  return request('/web/vipcard/addVipCard', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function updateVipCard(params) {
  return request('/web/vipcard/updateVipCard', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function addVipCardHistory(params) {
  return request('/web/vipcard/addVipCardHistory', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function delVipCard(params) {
  return request('/web/vipcard/delVipCard', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}


export async function getShopInfo(params) {
  return request('/web/users/getShopInfo4MiniPro', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function getVipCardHistoryList(params) {
  return request('/web/vipcard/getVipCardHistory', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}
export async function delOneServiceItem(params) {
  return request('/web/package/delOneServiceItem', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function delPackageTemplate(params) {
  return request('/web/package/delPackageTemplate', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function getShopSmsHistory(params) {
  return request('/web/sms/getShopSmsHistory', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function updateSmsSendState(params) {
  return request('/web/users/updateSmsSendState', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

/**
 * 代理商登录
 * @param params
 * @returns {Promise<void>}
 */
export async function channelLogin(params) {
  return request('/web/shoppingmall/channelerLogin', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

// 活动报名列表查询
export async function getEnrollList(params) {
  return request('/web/activity/enrollList', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

// 报名活动状态设置为已被联系
export async function setEnroll2Contacted(params) {
  return request('/web/activity/setEnroll2Contacted', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}












